/*
 * @Author: mayufo
 * @Date: 2020-02-16 01:07:32
 * @LastEditTime : 2020-02-16 01:10:03
 * @Description: 
 * @FilePath: /node/05/code/mongoose-demo/demo1.js
 */
const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:27017/test', {useNewUrlParser: true, useUnifiedTopology: true});

// 创建一个模型
// 就是设计数据库

const Cat = mongoose.model('Cat', { name: String });

// 实例化
const kitty = new Cat({ name: 'Zildjian' });
// 持久化保存kitty实例
kitty.save().then(() => console.log('meow'));